package com.jiawa.train.business.controller.admin;


import com.jiawa.train.business.req.TrainSeatQueryReq;
import com.jiawa.train.business.req.TrainSeatSaveReq;
import com.jiawa.train.business.req.TrainStationQueryReq;
import com.jiawa.train.business.req.TrainStationSaveReq;
import com.jiawa.train.business.resp.TrainSeatQueryResp;
import com.jiawa.train.business.resp.TrainStationQueryResp;
import com.jiawa.train.business.service.ITrainSeatService;
import com.jiawa.train.common.resp.CommonResp;
import com.jiawa.train.common.resp.PageResp;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 座位 前端控制器
 * </p>
 *
 * @author hrz
 * @since 2025-09-07
 */
@RestController
@RequestMapping("/admin/train-seat")
@RequiredArgsConstructor
public class TrainSeatAdminController {
    private final ITrainSeatService trainSeatService;

    @PostMapping("/save")
    public CommonResp<Object> save(@Validated @RequestBody TrainSeatSaveReq Req) {
        trainSeatService.saveTrainSeat(Req);
        return new CommonResp<>();
    }

    @GetMapping("/query-list")
    public CommonResp<PageResp<TrainSeatQueryResp>> queryList(@Validated TrainSeatQueryReq req) {
        PageResp<TrainSeatQueryResp> pa = trainSeatService.queryList(req);
        return new CommonResp<>(pa);
    }

    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable Long id) {
        trainSeatService.delete(id);
        return new CommonResp<>();
    }
}
